﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace HighScoreTest
{
	
	public partial class Form1 : Form
	{
		HighScore hs = new HighScore();
		public Form1()
		{
			InitializeComponent();
			UpdateListBox();
			
		}

		public void UpdateListBox()
		{
			List<HighScoreStruct> hss = hs.getHighScores();
			HighScoreslistBox.Items.Clear();

			foreach (HighScoreStruct h in hss)
			{
				HighScoreslistBox.Items.Add(h.Name + " / "  + h.Score.ToString() +" / " + h.CaveNumber.ToString());
			}
		}
		public void AddHighScore()
		{
		
				
		
			
		}

		private void AddNewHighscoreButton_Click(object sender, EventArgs e)
		{
			HighScoreStruct hss;

			hss.Name = NameTextBox.Text;
			hss.Score = int.Parse(ScoreTextBox.Text);
			hss.CaveNumber = int.Parse(CaveNumberTextBox.Text);

			hs.AddNewHighScore(hss);

			NameTextBox.Clear();
			ScoreTextBox.Clear();
			CaveNumberTextBox.Clear();

			UpdateListBox();
		}

	}
}
